{% extends "base.html" %}

{% load humanize i18n translations %}

{% block breadcrumbs %}
  <li class="breadcrumb-item">
    <a href="{{ object.get_absolute_url }}">{{ object }}</a>
  </li>
  <li class="breadcrumb-item">
    <a href="{% url 'backups' project=object.slug %}">{% translate "Backups" %}</a>
  </li>
{% endblock breadcrumbs %}

{% block content %}
  <div class="card">
    <div class="card-header">
      <h4 class="card-title">{% translate "Existing backups" %}</h4>
    </div>
    <table class="table">
      <tbody>
        {% for backup in backups %}
          <tr>
            <td>
              <a href="{% url "backups-download" project=object.slug backup=backup.name %}">{{ backup.name }}</a>
            </td>
            <td>{{ backup.size|filesizeformat }}</td>
            <td>{{ backup.timestamp|naturaltime }}</td>
          </tr>
        {% empty %}
          <tr>
            <td colspan="2">
              <em>{% translate "There are currently no backups." %}</em>
            </td>
          </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>

  <form method="post">
    <div class="card">
      <div class="card-header">
        <h4 class="card-title">{% translate "Trigger backup" %}</h4>
      </div>
      <div class="card-body">
        {% csrf_token %}
        <p>
          {% translate "Backup will be generated in the background." %}
          {% blocktranslate count count=keep_days %}Backups are removed after {{ keep_days }} day.{% plural %}Backups are removed after {{ keep_days }} days.{% endblocktranslate %}
        </p>
      </div>
      <div class="card-footer">
        <input type="submit" class="btn btn-primary" value="{% translate "Trigger backup" %}" />
      </div>
    </div>
  </form>

{% endblock content %}
